package com.itbupt.infrastructure.dao;

import com.itbupt.infrastructure.dao.po.PayOrder;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @Author dingchang
 * @Date 2025/5/10 0:08
 * @Description: 订单持久化接口
 */

@Mapper
public interface IOrderDao {

    /**
     * 插入一条订单记录
     * @param payOrder
     */
    void insert(PayOrder payOrder);

    /**
     * 查询未支付的订单
     * @param payOrder
     * @return
     */
    PayOrder queryUnPayOrder(PayOrder payOrder);

    /**
     * 更新订单状态-创建成功，待支付-PAY_WAIT
     * @param payOrderReq
     */
    void updateOrderPayInfo(PayOrder payOrderReq);

    /**
     * 更新订单状态-支付成功-PAY_SUCCESS
     * @param payOrderReq
     */
    void changeOrderPaySuccess(PayOrder payOrderReq);

    /**
     * 查询超时未支付订单
     * @return
     */
    List<String> queryTimeoutCloseOrderList();

    /**
     * 关闭订单 - 状态为 close
     * @return
     */
    boolean changeOrderClose(String orderId);

    /**
     * 查询未支付订单
     * @return
     */
    List<String> queryNoPayNotifyOrder();
}
